package com.zx.mes.rabbitmq.hyl.hello;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * hello 消息发送
 * @author hyl
 * @date 2018-3-16
 */
@Component
public class HelloProduce {

    private static final Logger logger = LoggerFactory.getLogger(HelloProduce.class);

    @Autowired
    private AmqpTemplate rabbitmqTemplate;

    public void send(){
        String context = "hello :" + new Date();
        logger.info("hello {}",context);
        this.rabbitmqTemplate.convertAndSend("hello",context);
    }
}
